package com.bee.common.core.jsonview;

import org.springframework.core.MethodParameter;

import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.method.support.HandlerMethodReturnValueHandler;
import org.springframework.web.method.support.ModelAndViewContainer;

public class JsonViewHandlerMethodReturnValueHandler implements
		HandlerMethodReturnValueHandler {

	@Override
	public void handleReturnValue(Object arg0, MethodParameter arg1,
			ModelAndViewContainer arg2, NativeWebRequest arg3) throws Exception {
	     
	}

	@Override
	public boolean supportsReturnType(MethodParameter returnType) {
		return ((AnnotationUtils.findAnnotation(returnType.getContainingClass(), ResponseBody.class) != null) ||
				(returnType.getMethodAnnotation(ResponseBody.class) != null));
	}

}
